package com.gaofeng.day10;

import java.util.Scanner;

/**
 * @author gaofeng
 * @date 2024-12-22 - 8:58
 */
public class demo05 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字");
        while (true){
            boolean isZs = true;
            int number = scanner.nextInt();
            for (int i = 2;i < Math.sqrt(number);i++){
                if(number % i == 0){
                    isZs = false;
                    System.out.println(number+"不是一个质数");
                    break;
                }
            }
            //只有当这个循环结束了，才能判断这个数字是不是质数
            if(isZs){
                System.out.println(number+"是一个质数");
            }


        }
//        scanner.close();

    }
}
